package com.pk.platform.business.charge.web;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.pk.platform.business.charge.service.IChargeIndexService;
import com.pk.platform.business.charge.service.ITuitionDetailService;
import com.pk.platform.business.charge.vo.TuitionDetailList;
import com.pk.platform.business.charge.vo.TuitionDetailVO;
import com.pk.platform.business.common.service.IChildService;
import com.pk.platform.business.common.vo.ChildVO;
import com.pk.platform.business.core.web.GenericAction;
import com.pk.platform.domain.charge.ChargeIndex;
import com.pk.platform.domain.charge.Tuition;
import com.pk.platform.domain.charge.TuitionDetail;
import com.pk.platform.domain.common.Child;
import com.pk.platform.util.DateConverter;
import com.pk.platform.util.SelectOption;

public class TuitionDetailAction extends GenericAction {

	private TuitionDetail td = new TuitionDetail();

	private TuitionDetailVO tdvo = new TuitionDetailVO();
	
	private ITuitionDetailService tuitionDetailService;
	
	private String[] tdIds;
	
	private String totalAmount;
	
	private Tuition tuition = new Tuition();
	
	private List<ChargeIndex> indexList = new ArrayList<ChargeIndex>();
	
	private List<Map<String, Object>> yearList = new ArrayList<Map<String,Object>>();
	
	private List<SelectOption> monthList = new ArrayList<SelectOption>();
	
	private IChargeIndexService chargeIndexService;
	
	private ChildVO childvo = new ChildVO();
	
	private Child child = new Child();
	
	private IChildService childService;
	
	public String tuitionDetailManage()
	{
		TuitionDetailList tdl = tuitionDetailService.queryTuitionDetail(tdvo, pager);
		lp = tdl.getListPage();
		totalAmount = tdl.getTotalAmount();
		monthList = DateConverter.getAllMonth(true);
		yearList = tuitionDetailService.queryYearOfOneTuition(tdvo.getTd().getId());
		indexList = chargeIndexService.queryChargeIndexList();
		return SUCCESS;
	}
	
	public String delTuitionDetail()
	{
		if(tdIds != null)
		{
			tuitionDetailService.delTuitionDetail(tdIds, tdvo.getTd().getId());
		}
		return SUCCESS;
	}
	
	public String thisMonthPayList()
	{
		child = childService.queryChildById(childvo.getChild().getId());
		lp = tuitionDetailService.queryThisMonthPayList(childvo.getChild().getId(), pager);
		return SUCCESS;
	}

	
	
	public TuitionDetail getTd() {
		return td;
	}

	public void setTd(TuitionDetail td) {
		this.td = td;
	}

	public TuitionDetailVO getTdvo() {
		return tdvo;
	}

	public void setTdvo(TuitionDetailVO tdvo) {
		this.tdvo = tdvo;
	}

	public ITuitionDetailService getTuitionDetailService() {
		return tuitionDetailService;
	}

	public void setTuitionDetailService(ITuitionDetailService tuitionDetailService) {
		this.tuitionDetailService = tuitionDetailService;
	}

	public String[] getTdIds() {
		return tdIds;
	}

	public void setTdIds(String[] tdIds) {
		this.tdIds = tdIds;
	}

	public String getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(String totalAmount) {
		this.totalAmount = totalAmount;
	}

	public Tuition getTuition() {
		return tuition;
	}

	public void setTuition(Tuition tuition) {
		this.tuition = tuition;
	}

	public List<ChargeIndex> getIndexList() {
		return indexList;
	}

	public void setIndexList(List<ChargeIndex> indexList) {
		this.indexList = indexList;
	}

	public List<SelectOption> getMonthList() {
		return monthList;
	}

	public void setMonthList(List<SelectOption> monthList) {
		this.monthList = monthList;
	}

	public IChargeIndexService getChargeIndexService() {
		return chargeIndexService;
	}

	public void setChargeIndexService(IChargeIndexService chargeIndexService) {
		this.chargeIndexService = chargeIndexService;
	}

	public List<Map<String, Object>> getYearList() {
		return yearList;
	}

	public void setYearList(List<Map<String, Object>> yearList) {
		this.yearList = yearList;
	}

	public ChildVO getChildvo() {
		return childvo;
	}

	public void setChildvo(ChildVO childvo) {
		this.childvo = childvo;
	}

	public Child getChild() {
		return child;
	}

	public void setChild(Child child) {
		this.child = child;
	}

	public IChildService getChildService() {
		return childService;
	}

	public void setChildService(IChildService childService) {
		this.childService = childService;
	}
	
}
